package micro_demo

import (
	"context"
	"protobuf/pb"

	"github.com/sirupsen/logrus"
	"go-micro.dev/v4"
)

func MicroClient(mins int32) error {
	// create a new service
	service := micro.NewService()

	// parse command line flags
	service.Init()
	// use the generated client stub
	client := pb.NewFutureService("future", service.Client())

	// make request
	resp, err := client.GetMinBar(context.Background(), &pb.BarRequest{Instrument: "rb2205", Mins: mins})
	if err != nil {
		return err
	}
	logrus.Info(resp)
	return nil
}
